DXL layout to display column with "ID" but only if attribute is true.

I'm new to DOORS/DXL and see that others can display a column with the Object ID only if another attribute called "Requirement" is true.
This is useful so this "Tag" column can be shown in the view and will not display the ID for objects such as headers or objects that are not requirements.

Any help would be great. Thanks in advance.
SystemAdmin - Fri Jun 12 11:39:23 EDT 2009

Re: DXL layout to display column with "ID" but only if attribute is true.
SystemAdmin - Fri Jun 12 12:09:43 EDT 2009

I figured it out...thanks.

if (null obj."Object Heading" "") {display ""}

Re: DXL layout to display column with "ID" but only if attribute is true.
brancwp - Fri Jun 19 16:38:37 EDT 2009

SystemAdmin - Fri Jun 12 12:09:43 EDT 2009
I figured it out...thanks.

if (null obj."Object Heading" "") {display ""}

Wait I want to do the exact same thing...I don't understand when you use the dxl line....
I have tried to make a little DXL program that creates a new attribute based on Object ID and wrap an IF statement around it so only if Reqt Type is equal to Threshold or Objective.
The DXL I have is this:
// create new attribute

create object type "Text" attribute "TestID"

// begin parameters (do not edit)
// One attribute/property per line: true
// Show attribute/property names: false
// Attribute: Object Identifier
// end parameters (do not edit)

Module m = current
AttrDef ad
AttrType at
m = module obj
ad = find(m,attrDXLName)
if(!null ad && ad.object)
{
at = ad.type
if (obj."Reqt Type" == "Threshold")
{
Buffer val = create
Buffer temp = create
probeRichAttr_(obj,"Object Identifier", temp, false)
val += tempStringOf temp
val = val "\n\\pard "
obj.attrDXLName = richText (tempStringOf val)
delete val
delete temp
}
}

// end of ObjectID.dxl

Well it does not like my undefined object at the m=module line and it does not like my syntack at the IF statement.
I can get rid of the create part and have them do that manually...

Re: DXL layout to display column with "ID" but only if attribute is true.
llandale - Sun Jun 21 17:27:04 EDT 2009

brancwp - Fri Jun 19 16:38:37 EDT 2009
Wait I want to do the exact same thing...I don't understand when you use the dxl line....
I have tried to make a little DXL program that creates a new attribute based on Object ID and wrap an IF statement around it so only if Reqt Type is equal to Threshold or Objective.
The DXL I have is this:
// create new attribute

create object type "Text" attribute "TestID"

// begin parameters (do not edit)
// One attribute/property per line: true
// Show attribute/property names: false
// Attribute: Object Identifier
// end parameters (do not edit)

Module m = current
AttrDef ad
AttrType at
m = module obj
ad = find(m,attrDXLName)
if(!null ad && ad.object)
{
at = ad.type
if (obj."Reqt Type" == "Threshold")
{
Buffer val = create
Buffer temp = create
probeRichAttr_(obj,"Object Identifier", temp, false)
val += tempStringOf temp
val = val "\n\\pard "
obj.attrDXLName = richText (tempStringOf val)
delete val
delete temp
}
}

// end of ObjectID.dxl

Well it does not like my undefined object at the m=module line and it does not like my syntack at the IF statement.
I can get rid of the create part and have them do that manually...

Use of 'attrDXLName' and use of undefined 'obj' means you are defining the code for Attribute-DXL; and this code will ONLY work when placed in Attr-DXL; it certainly won't work as a layout/trigger/on-demand script. Since Attr-DXL script runs for each object, it doesn't make sense to do things like create attributes; unless you put something like "if (this other attr doesn't exist) then create it".

It looks like you want an Attr-DXL named 'TestID' that displays the ObjID for Threshold Requirements. If so:

[1] Get rid of the create. Using the GUI, manually create a new Attr of type Text of Attr-DXL, using the rest of the code.

[2] The construct "obj.string" is not a string, its an AttrRef_. You need to convert it to a string before comparing it to Threshold:

if (obj."Reqt Type" "" == "Threshold")

That should work. However:

[3] Buffers are a waste of time for small strings, and in this case are NOT saving string table space when you concatenate a buffer with a string. You can get rid of 'val' and do this instead: temp += "\n\\pard ". And I do mean 'waste of time' since creating and deleting Buffers takes, relatively speaking, a very long time.

[4] I'd just use raw text: obj.attrDXLName = identifier(obj).

[5] Tsk tsk tsk, add an else clause when the object isn't a threshold: obj.attrDXLName = "".

5a I lied. Attr-DXL is recalculated when its value is null. Therefore, if you intend to display nothing you are better off displaying a space, so it doesn't thrash around recalculating: obj.attrDXLName = " ".

[6] I would check for the existence of attr 'Reqt Type' just in case; setting obj.attrDXLName = " ".

  • Louie

Re: DXL layout to display column with "ID" but only if attribute is true.
SystemAdmin - Sun Jun 21 19:02:21 EDT 2009

ipp156 wrote: "This is useful so this "Tag" column can be shown in the view and will not display the ID for objects such as headers or objects that are not requirements"

I'm curious - why is it a problem if all objects display their unique ID's? Or put another way, what is the risk\business case associated with this? If you can live without this need, it's just one less customisation to have to deal with.

When it comes to change management, which applies to "requirements" and "non requirements", as well as general communication between us carbon life forms :-), a unique ID is the most explicit means for identifying a specific object regardless of where it is in the document and whether it's categorised as a requirement or not.


Paul Miller

Re: DXL layout to display column with "ID" but only if attribute is true.
Tony_Goodman - Mon Jun 22 02:45:04 EDT 2009

SystemAdmin - Sun Jun 21 19:02:21 EDT 2009
ipp156 wrote: "This is useful so this "Tag" column can be shown in the view and will not display the ID for objects such as headers or objects that are not requirements"

I'm curious - why is it a problem if all objects display their unique ID's? Or put another way, what is the risk\business case associated with this? If you can live without this need, it's just one less customisation to have to deal with.

When it comes to change management, which applies to "requirements" and "non requirements", as well as general communication between us carbon life forms :-), a unique ID is the most explicit means for identifying a specific object regardless of where it is in the document and whether it's categorised as a requirement or not.


Paul Miller

If you want to highlight your requirements, then you could simply set the colour of the text displayed in the emain column according to the value of your attribute.
See Adding a Column in the help.

Re: DXL layout to display column with "ID" but only if attribute is true.
roybond - Mon Jun 22 08:35:14 EDT 2009

Tony_Goodman - Mon Jun 22 02:45:04 EDT 2009
If you want to highlight your requirements, then you could simply set the colour of the text displayed in the emain column according to the value of your attribute.
See Adding a Column in the help.

We use something similar, such that IDs are only displayed for Objects of specific data types, eg. Requirements.

This is done for many reasons, one of which being to make the printed document more readable when exported to MS Word.

Re: DXL layout to display column with "ID" but only if attribute is true.
brancwp - Mon Jun 22 10:29:36 EDT 2009

Thanks everyone for the help - especially Louie.
It works like a champ.
Using the following I can have the user create a new attribute with the right effect.
if ((obj."Reqt Type" "" == "Threshold") || (obj."Reqt Type" "" == "Objective") || (obj."Reqt Type" "" == "KPP"))
{
Buffer temp = create
probeRichAttr_(obj,"Object Identifier", temp, false)
temp += "\n\\pard "
obj.attrDXLName = richText (temp)
delete temp
}

Yes Paul this is so we can export it to word with the unique IDs only on the requirements. Looks like lots of people have this same need. Thanks Tony, I do use color coding to highlight Requirements.
I think I would still like a DXL script that I can just have them load and run and it would do it all, but that can wait until I actually learn DXL.

Thanks again...Pat

Re: DXL layout to display column with "ID" but only if attribute is true.
brancwp - Mon Jun 22 11:00:28 EDT 2009

Well maybe I spoke a little soon. Works great except it does put a hard return on the end of the attribute.
So anyone know how I make it Temp-1 character?

Re: DXL layout to display column with "ID" but only if attribute is true.
llandale - Mon Jun 22 13:53:37 EDT 2009

brancwp - Mon Jun 22 11:00:28 EDT 2009
Well maybe I spoke a little soon. Works great except it does put a hard return on the end of the attribute.
So anyone know how I make it Temp-1 character?

I'm not familiar with all that rich-text stuff, but you are inserting two EOLs into the Buffer, [1] \n and [2] \\pard.

Anyway, you should be able to truncate a buffer like this:

string Trunc = buf0:length(buf)-2

  • Louie

And as I said, forget the rich text version of ObjID: obj.attrDXLName = identifier(obj) will do.

Re: DXL layout to display column with "ID" but only if attribute is true.
SystemAdmin - Wed Aug 26 19:21:32 EDT 2009

brancwp - Mon Jun 22 10:29:36 EDT 2009
Thanks everyone for the help - especially Louie.
It works like a champ.
Using the following I can have the user create a new attribute with the right effect.
if ((obj."Reqt Type" "" == "Threshold") || (obj."Reqt Type" "" == "Objective") || (obj."Reqt Type" "" == "KPP"))
{
Buffer temp = create
probeRichAttr_(obj,"Object Identifier", temp, false)
temp += "\n\\pard "
obj.attrDXLName = richText (temp)
delete temp
}

Yes Paul this is so we can export it to word with the unique IDs only on the requirements. Looks like lots of people have this same need. Thanks Tony, I do use color coding to highlight Requirements.
I think I would still like a DXL script that I can just have them load and run and it would do it all, but that can wait until I actually learn DXL.

Thanks again...Pat

i am lost! i don't know DXL...but you are right i need to export into word with the unique IDs only on the requirements

please help anyone!

Re: DXL layout to display column with "ID" but only if attribute is true.
brancwp - Thu Aug 27 08:08:24 EDT 2009

SystemAdmin - Wed Aug 26 19:21:32 EDT 2009
i am lost! i don't know DXL...but you are right i need to export into word with the unique IDs only on the requirements

please help anyone!

1. Make sure you have a column with the Reqt Type or Object Type that identifies which objects are reqts
2. Then create new attribute Reqt_ID
a. Select Text type
b. Select DXL attribute and browse
c. Open New DXL and paste the below DXL
d. Check DXL and then Run it
4. Module now has Reqt_ID as a column
5. Delete column ID and move Reqt_ID to left
6. Save as Export View
7. Export to Office-Word
8. Check "do not include blank attributes

if ((obj."Reqt Type" "" == "Requirement") || (obj."Object Type" "" == "Requirement")
{
obj.attrDXLName = identifier(obj)
}

Re: DXL layout to display column with "ID" but only if attribute is true.
brancwp - Thu Aug 27 08:17:52 EDT 2009

brancwp - Thu Aug 27 08:08:24 EDT 2009
1. Make sure you have a column with the Reqt Type or Object Type that identifies which objects are reqts
2. Then create new attribute Reqt_ID
a. Select Text type
b. Select DXL attribute and browse
c. Open New DXL and paste the below DXL
d. Check DXL and then Run it
4. Module now has Reqt_ID as a column
5. Delete column ID and move Reqt_ID to left
6. Save as Export View
7. Export to Office-Word
8. Check "do not include blank attributes

if ((obj."Reqt Type" "" == "Requirement") || (obj."Object Type" "" == "Requirement")
{
obj.attrDXLName = identifier(obj)
}

Step 8 should be Uncheck "Include Empty Attributes"

Re: DXL layout to display column with "ID" but only if attribute is true.
SystemAdmin - Tue Sep 08 17:22:49 EDT 2009

brancwp - Thu Aug 27 08:17:52 EDT 2009
Step 8 should be Uncheck "Include Empty Attributes"

Thank you Pat...it worked great from the first time!